Analogous here Using rmarkdown because quarto and tmap are not working well together at the moment
Effects of wildfire smoke on daily respiratory acute-care utilization has been estimated at the zip-code level in California (Do et al).
Rate differences per 100,000 are estimated at the zip code level.
Effect modification of this effect by community characteristics has been estimated.
The increase in risk difference per IQR increase in air conditioning prevalence is -0.239302618 (95% CI, -0.41143431, -0.0671709235), the corresponding IQR for AC prevalence is 6.000915e-01.
Over-arching question: How would hypothetically changing the distribution of the effect modifiers affect the total burden and spatial distribution of respiratory acute-care utilization?
RD is per 100,000
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## -19.8663 -0.8485 -0.0663 0.1074 0.8228 29.6049
Distribution of air conditioning at the zip-code level
## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## 0.0000 0.2609 0.6250 0.5666 0.8710 1.0000 227
| ac_25th | ac_50th | ac_75th | ac_100th | ac_iqr |
|---|---|---|---|---|
| 0.2608696 | 0.625 | 0.8709678 | 1 | 0.6100982 |
For each zip code, calculate the change in the AC proportion from the status quo to the target percentile level. For example, if a zip code has a 50% AC prevalence, the difference from baseline to target in Scenario 1 is 12.5% (62.5%-50%).
Then, express that difference in terms of the number of IQRs that it represents. The IQR of AC is 0.61 (above). That zip code would raise its AC prevalence by
0.125/.61
## [1] 0.204918
Then, use that value to calculate the new risk difference under that scenario, following this equation:
rd_target_pt=rd_baseline_pt+rd_per_ac_iqr_pt*ac_prop_change_per_iqr
where
rd_target_pt = the zip code’s new risk difference under the scenario
rd_per_ac_iqr_pt = the increase in the risk difference per change in IQR of AC
ac_prop_change_per_iqr = the number of IQRs changed in that zip code in that scenario
This assumes that the increase is linear. It also assumes no confounding.
Considering 20 scenarios for 20 possible target percentile values (0th, 5th,….95th, 100th)
In each of 1,000 replicatess, re-sample rd_baseline_pt and rd_per_ac_iqr_pt from a normal distribution using the reported standard deviation and 95% CI (assuming confidence limit is estimate +/- 1.96*SD).
Then, in each replicate, propagate this uncertainty by re-calculating rd_target_pt using the re-sampled input values.
The resulting uncertainty interval is the 2.5th and 97.5th percentiles.
There are 1,396 total zip codes
| Target percentile | N, ZCTAS intervened | RD per 100k, baseline (sum over ZCTAs) | RD per 100k, baseline (sum over ZCTAs) (LL) | RD per 100k, baseline (sum over ZCTAs) (UL) | RD per 100k, target (sum over ZCTAs) | RD per 100k, target (sum over ZCTAs) (LL) | RD per 100k, target (sum over ZCTAs) (UL) | RD per 100k, difference (sum over ZCTAs) | RD per 100k, difference (sum over ZCTAs) (LL) | RD per 100k, difference (sum over ZCTAs) (UL) |
|---|---|---|---|---|---|---|---|---|---|---|
| 0.00 | 0 | 149.91 | 41.61 | 243.15 | 149.91 | 41.61 | 243.15 | 0.00 | 0.00 | 0.00 |
| 0.05 | 0 | 149.91 | 46.35 | 276.57 | 149.91 | 46.35 | 276.57 | 0.00 | 0.00 | 0.00 |
| 0.10 | 114 | 149.91 | 15.18 | 249.48 | 147.43 | 12.72 | 246.92 | -2.49 | -2.62 | -2.31 |
| 0.15 | 176 | 149.91 | 20.63 | 269.10 | 143.34 | 14.22 | 262.64 | -6.58 | -6.97 | -6.18 |
| 0.20 | 227 | 149.91 | 27.01 | 265.42 | 138.08 | 14.91 | 253.60 | -11.84 | -12.49 | -11.13 |
| 0.25 | 289 | 149.91 | 28.40 | 280.35 | 131.90 | 10.08 | 262.86 | -18.02 | -18.81 | -17.27 |
| 0.30 | 340 | 149.91 | 45.21 | 280.15 | 122.78 | 18.23 | 252.52 | -27.13 | -28.24 | -25.93 |
| 0.35 | 409 | 149.91 | 13.09 | 269.55 | 109.53 | -27.29 | 229.41 | -40.39 | -41.84 | -39.12 |
| 0.40 | 458 | 149.91 | 56.79 | 260.53 | 96.09 | 3.56 | 207.47 | -53.82 | -55.53 | -52.33 |
| 0.45 | 526 | 149.91 | 23.43 | 290.62 | 88.56 | -38.85 | 229.51 | -61.35 | -63.80 | -59.27 |
| 0.50 | 580 | 149.91 | -0.47 | 259.03 | 69.57 | -82.53 | 179.69 | -80.35 | -83.32 | -78.21 |
| 0.55 | 612 | 149.91 | 31.13 | 289.88 | 59.73 | -60.15 | 197.78 | -90.19 | -93.15 | -87.35 |
| 0.60 | 701 | 149.91 | 32.39 | 282.67 | 42.80 | -74.64 | 177.58 | -107.12 | -110.31 | -103.85 |
| 0.65 | 758 | 149.91 | 50.88 | 275.48 | 27.01 | -73.92 | 153.09 | -122.90 | -126.76 | -119.23 |
| 0.70 | 818 | 149.91 | -5.28 | 283.54 | 13.86 | -141.47 | 145.41 | -136.06 | -138.86 | -132.06 |
| 0.75 | 876 | 149.91 | 27.49 | 294.32 | -0.39 | -122.99 | 140.98 | -150.31 | -154.39 | -145.76 |
| 0.80 | 934 | 149.91 | 11.60 | 273.01 | -16.69 | -156.62 | 107.62 | -166.61 | -170.18 | -161.36 |
| 0.85 | 990 | 149.91 | 51.14 | 268.26 | -34.18 | -133.92 | 84.49 | -184.09 | -187.99 | -179.83 |
| 0.90 | 1013 | 149.91 | 35.71 | 272.57 | -48.83 | -162.30 | 71.63 | -198.74 | -203.52 | -193.94 |
| 0.95 | 1013 | 149.91 | 28.36 | 259.61 | -48.83 | -172.27 | 60.59 | -198.74 | -203.91 | -192.77 |
| 1.00 | 1013 | 149.91 | -15.44 | 285.03 | -48.83 | -213.78 | 87.14 | -198.74 | -203.68 | -194.44 |
Simply a plot the “difference in risk differences” column in the above table
Note this only includes every other scenario to facilitate clearer visualization.
Note x-axis is restricted to below 7 and above -7. How many does that exclude?
#how many are out of range if I censor x-axis at -7 and 7?
setwd(here("data-processed"))
load("wf_ac_scenarios_all_pt.RData")
wf_ac_scenarios_all_pt %>%
filter(target_percentile_decile==1) %>%
mutate(rd_target_pt_cat=case_when(
rd_target_pt>7~"7+",
rd_target_pt<=7 & rd_target_pt>-7~"-7 to 7",
rd_target_pt<=-7 ~"< -7"
)) %>%
group_by(rd_target_pt_cat) %>%
summarise(
n=n()) %>%
ungroup() %>%
mutate(prop=n/sum(n))
## # A tibble: 3 × 3
## rd_target_pt_cat n prop
## <chr> <int> <dbl>
## 1 -7 to 7 15119 0.985
## 2 7+ 160 0.0104
## 3 < -7 77 0.00501
Restricted to target RD above -7 and below 7 to more clearly see the meaningful range.
Comparing the target scenario with baseline.
Note this only includes every other scenario to facilitate clearer visualization
Diamond points are the mean over ZCTAs. Horizontal line is the median. Top and bottom of box are 25th and 75th percentiles.
Show how the distribution changes spatially over the scenarios
Values mapped are the risk difference per 100k for the corresponding scenario among those zip-codes that were intervened upon in that scenario.
A total of 20 scenarios are available. Choose two, 0.75 and 1.
Note to self: keep color scales constant between maps to facilitate comparison.
Another idea: a facet of static maps